home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / IPFlakeWay / Squelch Module / source / ProxyModule.h < prev   
Text File  |  2000-06-23  |  4KB  |  153 lines

  1. // =================================================================================
  2. //    ProxyModule.h                    ©1996 Sustainable Softworks. All rights reserved.
  3. // =================================================================================
  4. //    Shared definitions between Proxy Module and Clients
  5.  
  6. #ifndef _H_ProxyModule
  7. #define _H_ProxyModule
  8. #pragma once
  9.  
  10. #include "MyTypes.h"
  11.  
  12. // ---------------------------------------
  13. //    • IOCTL Calls for Proxy Module
  14. // ---------------------------------------
  15.  
  16. // Set monitor update events on or off
  17. enum
  18. {
  19.     I_MonitorOn                = MIOC_CMD(MIOC_CFIG, 0),
  20.     I_MonitorOff            = MIOC_CMD(MIOC_CFIG, 1),
  21.     I_SetPortName            = MIOC_CMD(MIOC_CFIG, 2),
  22.     I_SetApparentAddress    = MIOC_CMD(MIOC_CFIG, 3),
  23.     I_NatOn                    = MIOC_CMD(MIOC_CFIG, 4),
  24.     I_NatOff                = MIOC_CMD(MIOC_CFIG, 5),
  25.     I_AgeNatTable            = MIOC_CMD(MIOC_CFIG, 6),
  26.     I_SetActualNetwork        = MIOC_CMD(MIOC_CFIG, 7),
  27.     I_SetOnDemandName        = MIOC_CMD(MIOC_CFIG, 8),
  28.     I_OnDemandUp            = MIOC_CMD(MIOC_CFIG, 9),
  29.     I_OnDemandDown            = MIOC_CMD(MIOC_CFIG, 10),
  30.     I_OnDemandConnect        = MIOC_CMD(MIOC_CFIG, 11),
  31.     I_GetFullMap            = MIOC_CMD(MIOC_CFIG, 12),
  32.     I_GetStaticMap            = MIOC_CMD(MIOC_CFIG, 13),
  33.     I_AddMapEntry            = MIOC_CMD(MIOC_CFIG, 14),
  34.     I_DelMapEntry            = MIOC_CMD(MIOC_CFIG, 15),
  35.     I_LocalNatOn            = MIOC_CMD(MIOC_CFIG, 16),
  36.     I_LocalNatOff            = MIOC_CMD(MIOC_CFIG, 17),
  37.     I_GetFilters            = MIOC_CMD(MIOC_CFIG, 18),
  38.     I_AddFilterEntry        = MIOC_CMD(MIOC_CFIG, 19),
  39.     I_DelFilterEntry        = MIOC_CMD(MIOC_CFIG, 20),
  40.     I_GetPortNames            = MIOC_CMD(MIOC_CFIG, 21),
  41.     I_SetMonitorName        = MIOC_CMD(MIOC_CFIG, 22),
  42.     I_TRCableModem            = MIOC_CMD(MIOC_CFIG, 23),
  43.     I_TRCableModemOff        = MIOC_CMD(MIOC_CFIG, 24),
  44.     I_DNSForwardingOn        = MIOC_CMD(MIOC_CFIG, 25),
  45.     I_DNSForwardingOff        = MIOC_CMD(MIOC_CFIG, 26),
  46.     I_ClampMSS                = MIOC_CMD(MIOC_CFIG, 27),
  47.     I_SetExposedHost        = MIOC_CMD(MIOC_CFIG, 29)
  48. };
  49.  
  50. // Ioctl response codes
  51. const I_MonitorPause    = 0;
  52. const I_MonitorStart    = 1;
  53. const I_MonitorPending    = 2;
  54.  
  55. const kProxyNoError        = 0;
  56. const kProxyOnDemand    = 4;
  57. const kProxyAddError    = 5;    // NAT table error adding entry
  58. const kProxyDelError    = 6;    // Matching entry not found
  59. const kProxyTableError    = 7;
  60.  
  61. const size_t    kTimerSize        = 16;
  62. const UInt32    kTimerDelay     = 1000;
  63.  
  64. /*
  65.  * Define our timer message structure
  66.  */
  67. struct dl_timed_stat
  68. {
  69.     SInt32    dl_primitive;        // always DL_TIMED_STAT
  70.     SInt32    dl_sequence;         // sequence number to identify this message
  71.     SInt32    dl_wCount;            // our stats
  72.     SInt32    dl_rCount;
  73. };
  74. typedef struct dl_timed_stat dl_timed_stat_t;
  75.  
  76. #define DL_TIMED_STAT    1
  77.  
  78.  
  79. // Define our Proxy message structures
  80. // for Setting up NAT
  81. struct proxy_name {
  82.     UInt32        portNameHash;
  83. };
  84. typedef struct proxy_name proxy_name_t;
  85.  
  86. struct proxy_network {
  87.     UInt32        portNameHash;
  88.     NetNumber_t    net;
  89. };
  90. typedef struct proxy_network proxy_network_t;
  91.  
  92. struct proxy_age {
  93.     UInt32        portNameHash;
  94.     UInt32        age;
  95. };
  96. typedef struct proxy_age proxy_age_t;
  97.  
  98. struct proxy_mss {        // TCP MSS clamp for PPPoE
  99.     UInt32        portNameHash;
  100.     UInt32        mssClamp;
  101. };
  102. typedef struct proxy_mss proxy_mss_t;
  103.  
  104. struct proxy_map_entry {
  105.     UInt32            portNameHash;
  106.     PortMapEntry_t    mapEntry;
  107. };
  108. typedef struct proxy_map_entry proxy_map_entry_t;
  109.  
  110. // Identify what to monitor or translate
  111. const UInt16 kProtocolTypeNone    = 0x0000;
  112. const UInt16 kProtocolTypeIP    = 0x0800;
  113. const UInt16 kProtocolTypeARP    = 0x0806;
  114. const UInt16 kProtocolTypeRARP    = 0x8035;
  115.  
  116.  
  117. //
  118. // Structures for accessing NAT table
  119. //
  120.  
  121. // define our port map message structure
  122. #define kPortMapEntryDim    10
  123. #define DL_PORT_MAP            2
  124.  
  125. struct dl_port_map {
  126.     SInt32    dl_primitive;        // always DL_PORT_MAP
  127.     SInt16    dl_status;            // 1="More" or 0="End of Table"
  128.     SInt16    dl_number;            // number of entries reported
  129.     PortMapEntry_t array[kPortMapEntryDim];
  130. };
  131. typedef struct dl_port_map dl_port_map_t;
  132.  
  133. // selector values
  134. #define kStaticMap    1
  135. #define kFullMap    2
  136.  
  137.  
  138. // define our filter table message structure
  139. #define kFilterMessageDim    10
  140. #define DL_FILTER_MESSAGE    3
  141.  
  142. struct dl_filter_message {
  143.     SInt32    dl_primitive;        // always DL_FILTER_MESSAGE
  144.     SInt16    dl_status;            // 1="More" or 0="End of Table"
  145.     SInt16    dl_number;            // number of entries reported
  146.     FilterEntry_t array[kFilterMessageDim];
  147. };
  148. typedef struct dl_filter_message dl_filter_message_t;
  149.  
  150.  
  151. #endif
  152.  
  153.